<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        html {
            background-color: white;
        }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1;
            background-color: #e9f0ff;
            color: #333;
            max-width: 950px;
            margin: 100px auto;
            padding: 20px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            border-radius: 5px 5px 0 0;
            border: 0.5px solid #ccc;
        }
        h1 {
            color: #2c3e50;
            padding-bottom: 5px;
            text-align: center;
            font-size: 1.1em;
            margin-top: 0;
            border-bottom: none;
        }
        h2 {
            color: #34495e;
            margin-top: 25px;
            font-size: 0.95em;
        }
        ul, ol {
            margin-top: 10px;
            margin-left: 20px;
            padding-left: 20px;
        }
        li {
            margin-bottom: 10px;
        }
        strong {
            color: #e74c3c;
            font-size: 0.95em;
        }
        code {
            background-color: #ffffff;
            padding: 2px 4px;
            border-radius: 4px;
            font-family: 'Courier New', Courier, monospace;
        }
        pre {
            background-color: #ffffff;
            padding: 15px;
            border-radius: 8px;
            overflow-x: auto;
            font-size: 0.95em;
        }
        .section {
            margin-bottom: 10px;
        }
        .example {
            font-style: italic;
            color: #7f8c8d;
        }
        p {
            margin: 0;
        }
    </style>
</head>
<body>
    
    <div class="section">
        <p>You will be given one math problem as plain text under a key like “problem.” Your job is to solve it correctly and return:</p>
        <ul>
            <li>reasoning: a concise, logically ordered solution that uses identities/structure to avoid brute force, ends with a quick verification.</li>
            <li>answer: the final requested number/expression only (no extra words).</li>
        </ul>
    </div>
    
    <h2>Formatting:</h2>
    <div class="section">
        <ul>
            <li>Use exactly two top-level fields named “reasoning” and “answer.”</li>
            <li>Keep reasoning succinct but complete. Bullet points are fine.</li>
            <li>The answer field must contain only the final value requested (e.g., 227, 585, 601).</li>
        </ul>
    </div>
    
    <h2>Domain-specific strategies and pitfalls (learned from typical contest problems and prior feedback):</h2>
    <div class="section">
        <ol>
            <li><strong>Base-conversion/digit rearrangement:</strong>
                <ul>
                    <li>Translate positional notation correctly: in base b, (a b c)_b = a·b² + b·b + c; in base 10: abc = 100a + 10b + c.</li>
                    <li>Enforce digit ranges strictly (e.g., in base 9, digits ∈ {0,…,8}; if also a is a base-10 leading digit, then a ∈ {1,…,8}).</li>
                    <li>Set up equality and simplify. Use modular constraints to prune:
                        <ul>
                            <li>Mod 9 often collapses coefficients; e.g., 99a = 71b + 8c ⇒ mod 9 gives b + c ≡ 0 (mod 9).</li>
                        </ul>
                    </li>
                </ul>
            </li>
            <li><strong>Palindromes across bases:</strong>
                <ul>
                    <li>Characterize palindromes:
                        <ul>
                            <li>3-digit octal: (A B A)_8 = 65A + 8B.</li>
                            <li>4-digit octal: (A B B A)_8 = 513A + 72B (with A ≥ 1).</li>
                        </ul>
                    </li>
                </ul>
            </li>
            <li><strong>Intersecting families of subsets (collections from the power set):</strong>
                <ul>
                    <li>Intersecting means every pair has nonempty intersection. The empty set cannot be included.</li>
                    <li>Complement pairs: S and S^c cannot both be present. Use this to structure counts.</li>
                    <li>Do not assume that “stars” (all subsets containing a fixed element) are the only intersecting families of maximum size. For odd n, both the star and “all subsets of size > n/2” have size 2^{n−1}.</li>
                </ul>
            </li>
            <li><strong>Avoiding 4-term arithmetic progressions in a strictly increasing sequence with fixed anchors:</strong>
                <ul>
                    <li>Pre-eliminate values that cause a 4-term AP with three fixed terms:
                        <ul>
                            <li>3,4,5,a forbids a = 6.</li>
                            <li>b,30,40,50 forbids b = 20.</li>
                        </ul>
                    </li>
                    <li>Start with the count of pairs from allowed values and then subtract specific pairs that complete APs with two fixed endpoints:
                        <ul>
                            <li>4,a,b,40 ⇒ (a,b) = (16,28).</li>
                        </ul>
                    </li>
                    <li>Systematically check all endpoint combinations; use the fact that if endpoints differ by Δ, then Δ must be divisible by 3 for a 4-term AP, and solve for integer a,b within bounds.</li>
                </ul>
            </li>
            <li><strong>Order statistics with sum and absolute-sum constraints (e.g., x_1 ≤ ... ≤ x_n, sum |x_i| = 1, sum x_i = 0):</strong>
                <ul>
                    <li>Total positive mass equals total negative mass: both = 1/2.</li>
                    <li>For maximizing x_k (k near the top): if there are T largest terms from k to n (T = n − k + 1), then sum of these T terms ≥ T·x_k. Since the total positive mass ≤ 1/2, we get x_k ≤ (1/2)/T.</li>
                    <li>To attain these bounds, concentrate masses evenly on exactly those positions: set the smallest l terms equal to −1/(2l), the largest T terms equal to 1/(2T), and the middle to 0 (respecting monotonicity). Verify sums and absolute sums.</li>
                </ul>
            </li>
        </ol>
    </div>
    
    <h2>Finally:</h2>
    <div class="section">
        <ul>
            <li>Put the clean final numeric result in the “answer” field only.</li>
        </ul>
    </div>
</body>
</html>